package com.ling.pl.core.context;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * ContextFilter需要的登录登出接口
 */
public interface ContextSecurity {

    String cookieTokenKey = "LING_USERLOGININFO_COOKIE_TOKEN_KEY";

    /**
     * token部分 模拟登录
     */
    void login(Object userInfo);

    /**
     * 需要结合其他机制来判断用户是否在当前session登录,比如spring security或ibz的方法
     *
     * @param request
     * @param response
     * @return
     */
    boolean isLogin(HttpServletRequest request, HttpServletResponse response);

    /**
     * filter 用于容器的filter调用
     *
     * @param request
     * @param response
     */
    public void filter(HttpServletRequest request, HttpServletResponse response);

    /**
     * token部分 模拟登出
     */
    void logout(HttpServletRequest request, HttpServletResponse response);
}
